package com.sqpoll.android.member;

import android.content.Context;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.sqpoll.android.R;

/**
 * A item view of group member list.
 * 
 * @author Younggue Bae
 */
public class MemberListItemView extends LinearLayout {

	public static final String TAG = "MemberListItemView";
	
	Context mContext;
	int mLayoutResourceId;
	private ImageView mImageProfile;
	private TextView mName;

	public MemberListItemView(Context context, int layoutResourceId, Member item) {
		super(context);
		this.mContext = context;
		this.mLayoutResourceId = layoutResourceId;

		// layout inflation
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		inflater.inflate(mLayoutResourceId, this, true);

		// set profile image
		mImageProfile = (ImageView) findViewById(R.id.image_profile);
		//mImageProfile.setImageDrawable(item.getProfileImage());
		mImageProfile.setBackgroundDrawable(item.getProfileImage());

		// set name
		mName = (TextView) findViewById(R.id.name);
		mName.setText(item.getName());

	}

}